
/**
 * AppleIIGo
 * File Utilities
 * (C) 2008 by Marc S. Ressl (mressl@umich.edu)
 * Released under the GPL
 */

#include <stdio.h>
#include "fileutilities.h"

char * getFileExtension(char * diskImagePath) {
	char * fileExtension = 0;
	
	for (; *diskImagePath; diskImagePath++)
		if (*diskImagePath == '.')
			fileExtension = diskImagePath + 1;
	if (!fileExtension)
		fileExtension = diskImagePath;
	
	return fileExtension;
}

UINT32 getFileByteNum(char * diskImagePath) {
	FILE * diskImageFile;
	UINT32 diskImageByteNum;
	
	if (!(diskImageFile = fopen(diskImagePath, "rb")))
		return 0;
	fseek(diskImageFile, 0, SEEK_END);
	diskImageByteNum = ftell(diskImageFile);
	fclose(diskImageFile);
	
	return diskImageByteNum;
}
